/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.cs.mailbox.ACL;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.mailbox.Metadata;
/*    */ import com.zimbra.cs.mailbox.MetadataList;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import com.zimbra.cs.redolog.Version;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class SetPermissions
/*    */   extends RedoableOp
/*    */ {
/*    */   private int mFolderId;
/*    */   private String mACL;
/*    */   
/*    */   public SetPermissions()
/*    */   {
/* 31 */     super(MailboxOperation.SetPermissions);
/* 32 */     this.mFolderId = 0;
/* 33 */     this.mACL = "";
/*    */   }
/*    */   
/*    */   public SetPermissions(int mailboxId, int folderId, ACL acl) {
/* 37 */     this();
/* 38 */     setMailboxId(mailboxId);
/* 39 */     this.mFolderId = folderId;
/* 40 */     this.mACL = (acl == null ? "" : acl.toString());
/*    */   }
/*    */   
/*    */   protected String getPrintableData() {
/* 44 */     StringBuffer sb = new StringBuffer("id=").append(this.mFolderId);
/* 45 */     sb.append(", acl=").append(this.mACL);
/* 46 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException {
/* 50 */     out.writeInt(this.mFolderId);
/* 51 */     out.writeUTF(this.mACL);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException {
/* 55 */     this.mFolderId = in.readInt();
/* 56 */     this.mACL = in.readUTF();
/*    */   }
/*    */   
/*    */   public void redo() throws Exception
/*    */   {
/* 61 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/*    */     ACL acl;
/* 63 */     ACL acl; if (this.mACL.equals("")) {
/* 64 */       acl = null; } else { ACL acl;
/* 65 */       if (getVersion().atLeast(1, 36)) {
/* 66 */         acl = new ACL(new Metadata(this.mACL));
/*    */       } else
/* 68 */         acl = new ACL(new MetadataList(this.mACL));
/*    */     }
/* 70 */     mbox.setPermissions(getOperationContext(), this.mFolderId, acl);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/SetPermissions.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */